home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / FUNCTION.MOD < prev    next >
Text File  |  1989-01-18  |  580b  |  32 lines

  1.                                          (* Chapter 5 - Program 6 *)
  2. MODULE Function;
  3.  
  4. FROM InOut IMPORT WriteString, WriteInt, WriteLn;
  5.  
  6. PROCEDURE QuadOfSum(Number1, Number2 : INTEGER) : INTEGER;
  7. BEGIN
  8.    RETURN(4*(Number1 + Number2));
  9. END QuadOfSum;
  10.  
  11. VAR Dogs, Cats, Feet : INTEGER;
  12.  
  13. BEGIN  (* Main program *)
  14.    Dogs := 4;
  15.    Cats := 3;
  16.    Feet := QuadOfSum(Dogs,Cats);
  17.    WriteString("There are a total of");
  18.    WriteInt(Feet,3);
  19.    WriteString(" paws.");
  20.    WriteLn;
  21. END Function.
  22.  
  23.  
  24.  
  25.  
  26. (* Result of execution
  27.  
  28. There are a total of 28 paws.
  29.  
  30. *)
  31.  
  32.